<%@ include file="/common/taglibs.jsp"%> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>" type="text/css" />
		<link rel="stylesheet" href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>" type="text/css" />
	</head>
	<body >
		<div  id="headBar" class="head_content">
			<div class="finder-action"  >
				<div class="finder-action-inner clearfix">
					<button class="btn btn-large" onclick='location.href= "gd_type_add.html"' type="button">
						<span><span><i class="finder-icon"><img style="width: 24px; height: 24px; background-position: 0pt -316px;" class="imgbundle icon"
										src="<c:url value="/images/transparent.gif"/>" /> </i><fmt:message key="gd_type.add" /></span> </span>
					</button>
					<button class="btn" onclick="location.reload()" type="button">
						<span> <span> <i class="finder-icon"> <img style="width: 22px; height: 24px; background-position: 0pt -644px;" class="imgbundle icon"
										src="<c:url value="/images/transparent.gif"/>" /> </i>
							<fmt:message key="button.refresh" /> </span> </span>
					</button>
					<button class="btn" type="button">
						<span><span><i class="finder-icon"><img style="width: 17px; height: 24px; background-position: 0pt -757px;" class="imgbundle icon"
										src="<c:url value="/images/transparent.gif"/>" /> </i>
							<fmt:message key="button.delete" />
						</span> </span>
					</button>
				</div>
			</div>
			<div   class="finder-header"> 
				<table cellpadding="0" cellspacing="0" width="100%">
					<!----cols---->
					<col style="width: 74px;" class="span-select" />
					<col style="width: 110px;" />
					<col style="width: 150px;" />
					<col style="width: 75px;" />
					<col />
					<!----cols---->
					<thead>
						<tr>
							<td>
								<table cellpadding="0" cellspacing="0" width="100%">
									<tbody>
										<tr>
											<td>
												<span class="finder-col-label"><fmt:message key="common.operation" /></span>
											</td> 
										</tr>
									</tbody>
								</table>
							</td>
							<td>
								<fmt:message key="button.delete" />
							</td>
							<td>
								<div class="cell orderable" key="name">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label"> <fmt:message key="gd_type.name" /></span>
												</td> 
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell orderable" key="is_physical">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label"> <fmt:message key="gd_type.physical_flag" /></span>
												</td> 
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
					</thead>
				</table>
			</div>

		</div>
		<div  id="main" class="main_content">
			<div class="finder-list finder-list-normal"  >
				<table cellpadding="0" cellspacing="0" width="100%">
					<!----cols---->
					<col style="width: 74px;" class="span-select" />
					<col style="width: 110px;" />
					<col style="width: 150px;" />
					<col style="width: 75px;" />
					<col />
					<!----cols---->
					<tbody>
						<c:forEach var="list" items="${goodsTypes}" varStatus="vs">
							<tr class="row <c:if test="${vs.index%2!=0}">even </c:if>">

								<td>
									<div class="cell">
										<a href="gd_type_edit.html?typeId=${list.typeId }"><img src="<c:url value="/images/transparent.gif"/>" class="imgbundle"
												style="width: 15px; height: 16px; background-position: 0pt -133px;" /> <fmt:message key="button.edit" />  </a>
									</div>
								</td>
								<td onclick="deleteType(this,${list.typeId });" style="cursor: pointer;">
									<img border="0" style="width: 16px; height: 16px; background-position: 0pt -214px;" class="imgbundle" src="<c:url value="/images/transparent.gif"/>" />
								</td>
								<td class="editable">
									<div class="cell">
										${list.name }
									</div>
								</td>
								<td key="is_physical">
									<div class="cell">										
										<fmt:message key="common_${list.physicalOn }" />
									</div>
								</td>
								<td>
									&nbsp;
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table> 
			</div>

		</div>
		<div id="footBar" class="foot_content">
			<div class="finder-footer" id="finder-footer-edd8e6">
				<div class="finder-page clearfix">

					<div class="span-auto"></div>
					<div class="span-auto textright"> 
						<fmt:message key="page.total" >
									<fmt:param><i>${fn:length(goodsTypes)}</i></fmt:param>
								</fmt:message>
					</div>
				</div>
			</div> 
		</div>
		<script type="text/javascript" src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<%@ include file="/jsp/admin/common/messages.jsp"%>
		<script type="text/javascript">
			function deleteType(clickedDom,typeId){
				if(!confirm('<fmt:message key="common.confirm_deleted" />')){
					return;
				}
				
				var url = "gd_type_delete.html";
				var params = {
					"typeId" : typeId
				};
		
				$.getJSON(url, params, 
					function callback(data) 
					{	var flag = data.successFlag;
						var returnString='';
						if(flag){
							returnString = '<fmt:message key="common.deleted" />'; 
							$(clickedDom).parent().remove();
						}else{
							returnString = '<fmt:message key="gd_specfication.delete_fail" />';
						}
						showCallbackResult(returnString);
					}
				);
			}
		</script>
	</body>
</html>